Program 7.6: Hidden Lines
This is another straightforward interpretation of Program 7.6:
Hidden Lines. In this version, the names of the flags have been
made a bit clearer since FL
, F
, and
FG
became very confusing.
The thing that strikes me most about this is that it's using a very simple version of z-buffering because it knows what the viewing angle will be. If we wanted to change the view, we would have to ensure that the lines are still drawn from front to back.
I had some fun plotting other functions using this algorithm, like the one from Program 7.5: Surface, below. Because this is drawing lines and not surfaces, there are sometimes artifacts where a line shows through just because there is too big a gap. Some functions don't work well at all.
Try out a functon of your own. Any valid JavaScript expression will work.
z(x, y) =